﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyCalc
{
    /// <summary>
    /// 计算器类
    /// </summary>
    public class Calculator
    {
        private int num1 = 0;
        private string num1string = "";
        public string InputNum1 {
            get {
                return num1.ToString();
            }
            set { 
                num1=int.Parse(value);
            } 
        }


        private int num2 = 0;
        public string InputNum2 {
            get {
                return num2.ToString();
            }
            set { 
                num2=int.Parse(value);
            } 
        }
        /// <summary>
        /// 运算符
        /// + - * /
        /// </summary>
        public string Option {  get; set; }
        public int OutputNum {  get; set; }
        /// <summary>
        /// 计算
        /// </summary>
        public void Calc()
        {
            //num1 = int.Parse(InputNum1);
            //num2 = int.Parse(InputNum2);
            switch (Option) {
                case "+":
                    OutputNum = num1 + num2;
                    break;
                case "-":
                    OutputNum = num1 - num2;
                    break;
                case "*":
                    OutputNum = num1* num2;
                    break;
                case "/":
                    OutputNum = num1 / num2;
                    break;
            }
        }
    }
}
